package com.hunktimes.wholesale.widget

import android.graphics.*
import android.graphics.drawable.Drawable
import androidx.annotation.ColorInt

class EmptyCornerDrawable : Drawable {
    override fun setAlpha(alpha: Int) {

    }

    override fun getOpacity(): Int = PixelFormat.OPAQUE

    override fun setColorFilter(colorFilter: ColorFilter?) {

    }

    val mPaint by lazy { Paint(Paint.ANTI_ALIAS_FLAG) }
    var radius: Float = 0f;

    constructor(@ColorInt color: Int, radius: Float) : super() {
        mPaint.color = color
        mPaint.style = Paint.Style.FILL
        this.radius = radius
    }

    override fun draw(canvas: Canvas) {

        val rectf = bounds.let {
            RectF(it.left.toFloat(), it.top.toFloat(), it.right.toFloat(), it.bottom.toFloat())
        }
        canvas.drawRoundRect(rectf, radius, radius, mPaint)
    }


}